package com.youpai.platform.pay.service.enums;

import com.youpai.platform.common.enums.ProcessCodeEnum;
import com.youpai.platform.common.exceptions.BaseBizException;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

/**
 * @date: 2022/12/25
 * @author: Welles
 * @version: 1.0
 * @description: App对应包
 */
@AllArgsConstructor
@NoArgsConstructor
public enum AppPackageEnum {

    KILA(1, "com.kila.android"),
    ;


    /**
     * appId
     */
    public int appId;

    /**
     * app包
     */
    public String appPackage;

    /**
     * 通过appId获取包路径
     *
     * @param appId appId
     * @return 包路径
     */
    public static String getAppPackageByAppId(int appId) {
        for (AppPackageEnum value : AppPackageEnum.values()) {
            if (value.appId == appId) {
                return value.appPackage;
            }
        }
        throw new BaseBizException(ProcessCodeEnum.APP_NOT_EXIST);
    }
}
